package com.k2data.k2app.domain.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.k2data.k2app.domain.vo.Device;

import java.io.IOException;

/**
 * @author lidong9144@163.com 17-3-22.
 */
public class DeviceSerializer extends JsonSerializer<Device> {

    @Override
    public void serialize(Device dictDTO, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeStartObject();
        gen.writeNumberField("deviceId", dictDTO.getDeviceId());
        gen.writeStringField("deviceNo", dictDTO.getDeviceNo());
        gen.writeStringField("deviceName",dictDTO.getDeviceName());
        gen.writeEndObject();
    }

}
